package com.zhanglijie.theory.immutable;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/7/22 0022 22:10
 */
public class StingImmutableTest {
    public static void main(String[] args) {
        String name = "zhangsan";
        String subStr = name.substring(0);// return (beginIndex == 0) ? this : new String(value, beginIndex, subLen);
        System.out.println("name hashcode"+name.hashCode());
        System.out.println("subStr hashcode"+subStr.hashCode());
        System.out.println(name.hashCode() == subStr.hashCode());
    }
}
